package com.neusoft.elmboot.controller;

import java.math.BigDecimal;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.neusoft.elmboot.po.VirtualWallet;
import com.neusoft.elmboot.po.VirtualWalletTransaction;
import com.neusoft.elmboot.service.VirtualWalletService;

/**
 * @author chj
 * @date 2024年10月20日
 */
@RestController
@RequestMapping("/VirtualWallet")
public class VirtualWalletController {

	@Autowired
	private VirtualWalletService virtualWalletService;

	@PostMapping("/VirtualWalletId")
	public int saveVirtualWallet(Long walletId) {
		return virtualWalletService.saveVirtualWallet(walletId);
	}

	@PutMapping("/Debit")
	public int debit(Long walletId, BigDecimal amount) {
		return virtualWalletService.debit(walletId, amount);
	}

	@PutMapping("/Credit")
	public int credit(Long walletId, BigDecimal amount) {
		return virtualWalletService.credit(walletId, amount);
	}

	@PutMapping("/Transfer")
	public int transfer(Long fromWalletId, Long toWalletId, BigDecimal amount) {
		return virtualWalletService.transfer(fromWalletId, toWalletId, amount);
	}

	@GetMapping("/VirtualWalletId")
	public VirtualWallet getVirtualWallet(Long walletId) {
		return virtualWalletService.getVirtualWallet(walletId);
	}

	@GetMapping("/TransactionList")
	public List<VirtualWalletTransaction> listTransactions(Long walletId) {
		return virtualWalletService.listTransactions(walletId);
	}

	@GetMapping("/Balance")
	public BigDecimal getBalance(Long walletId) {
		return virtualWalletService.getBalance(walletId);
	}

	@PutMapping("/CloseVIP")
	public int closeVIP(Long walletId) {
		return virtualWalletService.closeVIP(walletId);
	}

	@PutMapping("/OpenVIP")
	public int openVIP(Long walletId) {
		return virtualWalletService.openVIP(walletId);
	}

	@PutMapping("/Frozen")
	public int frozen(Long walletId, BigDecimal frozenAmount) {
		return virtualWalletService.frozen(walletId, frozenAmount);
	}

	@PutMapping("/Unfrozen")
	public int unfrozen(Long walletId, BigDecimal frozenAmount) {
		return virtualWalletService.unfrozen(walletId, frozenAmount);
	}

	@PutMapping("/IncreaseOverdraftAmount")
	public int increaseOverdraftAmount(Long walletId, BigDecimal overdraftAmount) {
		return virtualWalletService.increaseOverdraftAmount(walletId, overdraftAmount);
	}

	@PutMapping("/DecreaseOverdraftAmount")
	public int decreaseOverdraftAmount(Long walletId, BigDecimal overdraftAmount) {
		return virtualWalletService.decreaseOverdraftAmount(walletId, overdraftAmount);
	}

	@PutMapping("/CloseOverdraft")
	public int closeOverdraft(Long walletId) {
		return virtualWalletService.closeOverdraft(walletId);
	}

	@PutMapping("/OpenOverdraft")
	public int openOverdraft(Long walletId) {
		return virtualWalletService.openOverdraft(walletId);
	}

}
